﻿@model IEnumerable<Cafeteria.Models.Venta.Venta.VentaBean>

@{
    ViewBag.Title = "Buscar";
}

<h2>Buscar</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>


@using (Html.BeginForm("Buscar", "Venta", FormMethod.Post, new { @class = "form" }))
{
    @Html.ValidationSummary(false)
    <fieldset>
        <div class = "widget" >
            <div class = "title"><h6>Buscar Ventas realizadas</h6></div>

            <div class="formRow">
               <span>Sucursal</span>                             
                
                <div class = "formRight" >
                <div class = "selector">@Html.DropDownListFor(modelitem => modelitem.ElementAt(0).idSucursal, Model.ElementAt(0).listaTipo)</div></div>
                <div class = "clear" ></div>
            </div>

            <div class="formRow">
                <label>Fecha</label>
                <div class = "formRight" ><input type = "text" id = "fecha" name = "fecha" class="validate[required,custom[onlyLetterSp]]" ,name="lettersValid", maxlength = "50", placeholder = "Maximo 50 caracteres aqui" /></div>
                <div class = "clear" ></div>
            </div>
        </div>
    </fieldset>
    <p>
        <input type="submit" value="Buscar" class = "redB" />
        <a href="javascript:history.back()">Regresar</a> 
    </p>
}



@if (ViewBag.dat== 0)
{    
    <div class="wrapper">
        <div class="widget">
          <div class="title"><h6>Lista de ventas realizadas</h6></div>
          <div class="dataTables_wrapper">
          
              <table cellpadding = "0" cellspacing = "0" width = "100%" class = "display dTable"> 
                <thead>
                <tr>
                    <th class="ui-state-default" rowspan="1" colspan="1" style="width:100px;" >
                        <div class="DataTables_sort_wrapper">
                        Sucursal
                        <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                        </div>
                     </th>
                    <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                        <div class="DataTables_sort_wrapper">
                        Fecha
                        <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                        </div>
                     </th>
                     <th class="ui-state-default" rowspan="1" colspan="1" style="width:180px;" >
                        <div class="DataTables_sort_wrapper">
                        Monto total
                        <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                        </div>
                     </th>
                    <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >

                    </th>
                </tr>
            </thead>
                <tbody>
               @foreach (var item in Model)
                {
                    <tr class="gradeA odd">
                        <td class=" sorting_1">@Html.DisplayFor(modelItem => item.nombresucursal)</td>
                        <td class=" sorting_1">@Html.DisplayFor(modelItem => item.fecharegistro) </td>
                        <td class=" sorting_1">@Html.DisplayFor(modelItem => item.totalventa)</td>
                        <td class=" sorting_1">
                            
                            <a href="@Url.Action("Details", new { id = item.idventa })"><img src="../../Content/images/icons/color/pencil.png", alt="Edit" />detalle </a> 

                        </td>
                    </tr>
        
                }
            </tbody>
              
              </table>                                                                                                                                                                                                <table cellpadding = "0" cellspacing = "0" width = "100%" class = "display dTable">
                           
               
          </div>
        
        </div>
    </div>
    
    
}